//package com.Nuyoah.demo01.controller;
//
//import com.Nuyoah.demo01.common.JsonResult;
//import com.Nuyoah.demo01.entity.User;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//@RestController
//@RequestMapping("/jsonresult")
//public class JsonResultController {
//    @RequestMapping("/user")
//    public JsonResult<User> getUser(){
//        User user = new User(1,"测试","123456");
//        return new JsonResult<>(user);
//    }
//
//    @RequestMapping("/list")
//    public JsonResult<List> getUserList(){
//        List<User> userList = new ArrayList<>();
//        User user1 =  new User(1,"测试1","123456");
//        User user2 =  new User(2,"测试2","123456");
//        userList.add(user1);
//        userList.add(user2);
//        return new JsonResult<>(userList,"获取用户信息成功");
//    }
//
//    @RequestMapping("/map")
//    public JsonResult<Map> getUserMap(){
//        Map<String,Object> map = new HashMap<>(3);
//        User user  = new User(1,"筱昊",null);
//        map.put("作者信息：",user);
//        map.put("联系方式：","1234564786");
//        map.put("性别：","未知");
//        map.put("年龄：","保密");
//        map.put("婚姻状态：","保密");
//        return new JsonResult<>(map);
//    }
//
//    @RequestMapping("/userParam")
//    public JsonResult<User> getUser2(@RequestParam(name = "id",required = true) Integer id){
//        User user = new User(id,"测试","123456");
//        return new JsonResult<>(user);
//    }
//
//    @PostMapping("/userParam1")
//    public JsonResult<User> getUser3(@RequestBody User user){//这样必须传json格式，不能传form
//        return new JsonResult<>(user);
//    }
//}
